<html>
<head>
</head>
<body>
</body>
<script src="../js/require.js"></script>
<script>
require(['../js/appConf','../js/sysman','../js/oa',
		 '../js/supply'], function() {
    // Configuration loaded now, safe to do other require calls
    // that depend on that config.
    require(['loginSignModule','sysmanMain','msgServ','init','domReady!'], function(loginSignModule,module,msgServ,init,doc) {
		
		
		 //获取url中的参数
        var getUrlParam =function(name){
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
		
		var userid = getUrlParam('loginname');
		
		window.console.log('loginname: ' + userid);
		
		if(userid!=null){
		
			var _param = {
				loginname: userid,
				site: 'supply',
				logintype: 'sso'
			}
		
			//登录系统
			$.ajax({
				url:'/biz/login.action',
				data:_param,
				success:function(data){
					
					if (data && data.retStatus) {
						//判断用户登录状态
						if(data.retStatus==='success') {											
							module.setCurrentUser(data.retData);
							init.setCurrentUser(data.retData);
							window.location.href = data.retStr;						
						}else{					
							alert(data.retStr);								
						}
		
					}
					
				}
			
			})
		
		
    	};
    });
});
</script>
</html>